﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace SerialPort_URAT
{
    public partial class LEV_ST_Monitor_Form
    {
        int TatolSystemStatusVarsNum = 34; //int bytes
        //============================================
        //set Global Values Label string and text box; TwoColumnTextBox
        string[] GlobalValuesLabelString = 
            {
                "Status Data Length               ",    //not to remove
                ///////////////////////////////////////////////////////////////
"SysModeStatusCode                               ",
"Module_Status                                   ",
"Module_Function_Status                          ",
"Add_Module_Function_Status                      ",
"Device_Interface_Status                         ",
"Extend_Device_Interface_Status                  ",
"Capacity_Var_Bits_Status                        ",
"DSG_Current_ADC                                 ",
"CHG_Current_ADC                                 ",
"VBAT_ADC                                        ",
"NTC1_ADC                                        ",
"NTC2_ADC                                        ",
"Vref_mVoltage                                   ",
"Current_Capacity                                ",
"Hold_Capacity                                   ",
"AVG_DSG_Current_ADC                             ",
"RECORD_DATA_COUNT                               ",
"MAX_DSG_C_ADC_RECORD                            ",
"MAX_CHG_C_ADC_RECORD                            ",
"MAX_VBAT_ADC_RECORD                             ",
"MIN_VBAT_ADC_RECORD                             ",
"MAX_VBAT_SocLo_ADC_RECORD                       ",
"MAX_VBAT_SocHi_ADC_RECORD                       ",
"DSG_MAX_TH1_ADC_RECORD                          ",
"DSG_MIN_TH1_ADC_RECORD                          ",
"DSG_MAX_TH2_ADC_RECORD                          ",
"DSG_MIN_TH2_ADC_RECORD                          ",
"CHG_Cycle_Count_RECORD                          ",
"CHG_ADC_AccumulatingQ_RECORD_Hi                 ",
"CHG_ADC_AccumulatingQ_RECORD_Lo                 ",
"DSG_ADC_AccumulatingQ_RECORD_Hi                 ",
"DSG_ADC_AccumulatingQ_RECORD_Lo                 ",
"DSG_Cycle_Count_RECORD                          ",
"CHG_MAX_TH1_ADC_RECORD                          ",
"CHG_MIN_TH1_ADC_RECORD                          ",
"CHG_MAX_TH2_ADC_RECORD                          ",
"CHG_MIN_TH2_ADC_RECORD                          ",
"OVP_TIMES                                       ",
"UVP_TIMES                                       ",
"COCP_TIMES                                      ",
"DOCP_TIMES                                      ",
"TH1_CHG_UTP_TIMES                               ",
"TH2_CHG_UTP_TIMES                               ",
"CHG_TH1_OTP_TIMES                               ",
"CHG_TH2_OTP_TIMES                               ",
"DSG_TH1_LOW_CURRENT_OTP_TIMES                   ",
"DSG_TH1_HIGH_CURRENT_OTP_TIMES                  ",
"DSG_TH2_LOW_CURRENT_OTP_TIMES                   ",
"DSG_TH2_HIGH_CURRENT_OTP_TIMES                  ",
"RECORD_2nd_DATA_COUNT                           ",
"REAL_FCC_UPDATE_TIMES                           ",
"Real_FCC_In_CoulombCounter                      ",
"Derating_FCC_In_CoulombCounter                  ",
"RM_In_CoulombCounter                            ",
"Capacity_In_CoulombCounter                      ",
"STATIC_OVER_VOLTAGE_HOURS_TIMES                 ",
"CHG_OVER_VOLTAGE_MINUTES_TIMES                  ",
"OVER_LOADING_MINUTES_TIMES                      ",
"FASTER_CHARGING_MINUTES_TIMES                   ",
"CHARGING_IN_HIGH_TEMP_MINUTES_TIMES             ",
"CHARGING_IN_LOW_TEMP_MINUTES_TIMES              ",
"STORE_IN_LOW_TEMP1_HOURS_TIMES                  ",
"STORE_IN_LOW_TEMP2_HOURS_TIMES                  ",
"STORE_IN_LOW_TEMP3_HOURS_TIMES                  ",
"STORE_IN_LOW_TEMP4_HOURS_TIMES                  ",
"STORE_IN_HIGH_TEMP1_MINUTES_TIMES               ",
"STORE_IN_HIGH_TEMP2_MINUTES_TIMES               ",
"STORE_IN_HIGH_TEMP3_MINUTES_TIMES               ",
"STORE_IN_HIGH_TEMP4_MINUTES_TIMES               ",
"STORE_IN_HIGH_TEMP5_MINUTES_TIMES               ",
"RECORD_3rd_TRACKING_DATA_COUNT                  ",
"NTC1_Real_0p1_KelvinDegree                      ",
"NTC2_Real_0p1_KelvinDegree                      ",
"Last_FCC_Updated_Values                         ",
"AVG_Battery_Voltage_ADC                         ",
"System_Activated_TotalHours                     ",
"Count_TimesOfAutoWakeUp_InSleeping_Hi           ",
"Count_TimesOfAutoWakeUp_InSleeping_Lo           ",
"System_Device_Extend_1_Status                   ",
"Current_ChargingTimes_Minutes                   ",
"Last_ChargingTimes_Minutes                      ",
"Max_ChargingTimes_Minutes                       ",
"Current_InSleepingMode_Times_Hi                 ",
"Current_InSleepingMode_Times_Lo                 ",
"NowTotalTimes_Without_Charging_Minutes_Hi       ",
"NowTotalTimes_Without_Charging_Minutes_Lo       ",
"LastTotalTimes_Without_Charging_Minutes_Hi      ",
"LastTotalTimes_Without_Charging_Minutes_Lo      ",
"MaxTotalTimes_Without_Charging_Minutes_Hi       ",
"MaxTotalTimes_Without_Charging_Minutes_Lo       ",
"NowTotalTimes_Without_DisCharging_Minutes_Hi    ",
"NowTotalTimes_Without_DisCharging_Minutes_Lo    ",
"LastTotalTimes_Without_DisCharging_Minutes_Hi   ",
"LastTotalTimes_Without_DisCharging_Minutes_Lo   ",
"MaxTotalTimes_Without_DisCharging_Minutes_Hi    ",
"MaxTotalTimes_Without_DisCharging_Minutes_Lo    ",
"RECORDING_ADC_DSG_OVER_CURRENT_1_6sec_Hi        ",
"RECORDING_ADC_DSG_OVER_CURRENT_1_6sec_Lo        ",
"RECORDING_ADC_DSG_OVER_CURRENT_2_6sec_Hi        ",
"RECORDING_ADC_DSG_OVER_CURRENT_2_6sec_Lo        ",
"RECORDING_ADC_DSG_OVER_CURRENT_3_6sec_Hi        ",
"RECORDING_ADC_DSG_OVER_CURRENT_3_6sec_Lo        ",
"RECORDING_ADC_DSG_OVER_CURRENT_4_6sec_Hi        ",
"RECORDING_ADC_DSG_OVER_CURRENT_4_6sec_Lo        ",
"RECORDING_ADC_DSG_OVER_CURRENT_5_6sec_Hi        ",
"RECORDING_ADC_DSG_OVER_CURRENT_5_6sec_Lo        ",
"RECORDING_ADC_DSG_OVER_CURRENT_6_6sec_Hi        ",
"RECORDING_ADC_DSG_OVER_CURRENT_6_6sec_Lo        ", 

            };
        private TextBox[] GlobalValuesText;
        private Label[] GlobalValuesLabel;
        //============================================
 
        //============================================


        //============================================
        //set Current Status string
        string[] SysModeStatusText = //unsigned char
        {
            "UnKnowStatus",
            "StartUp",
            "POSTMode", //Power-on self-test
            "NormalMode",
            "FailureMode",
            "ShutdownMode",
            "CalibrationMode",
            "ShippingMode",
            "SuspendMode",
            "SleepingMode",
            "Sleeping_AutoWakeupMode"

        };
        private Label SysModeStatusLabel;

        //============================================
        //set Bit Label string ; 14 length
        // 15~8 bits
        // 7~0 bits
        string[] G_SysModuleStatusText =
        {
            "DSG_OT","CHG_OT","-","-","BAT_UV","BAT_OV","C_OC","D_OC",
            "Current_CHG_NoDelay","UT","Dynamic_UVP","DSG_mosfail","CHG_mosfail","Current_DSG","Current_Static","Current_CHG"
        };
        private Label[] G_SysModuleStatusLabel;
        //============================================
        //============================================
        //set Bit Label string ; 14 length
        // 15~8 bits
        // 7~0 bits
        string[] G_Module_Function_StatusText =
        {
            "1 sec flag","After UVP Delay","SW turn off dsg","Init chg temp range","Use hi OT setting","Dsg Hi current for Ot","DSG_High_OTA","DSG_LOW_OTA",
            "AutoSleepingEntry","Low temp Soc set","Coc lock","CocR repeat chk","Coc count finish","Enable Coc count","Doc count finish","Enable Doc count"
        };
        private Label[] G_Module_Function_StatusLabel;
        //============================================

        //============================================
        //set Bit Label string ; 14 length
        // 15~8 bits
        // 7~0 bits
        string[] G_Add_Module_Function_StatusText =
        {
            "OCP for USB","enable USB output","OneWireTransmitByCmd","OneWireTransmitAlways","ONE_WIRE_Send_EEPROM_Data","ONE_WIRE_TEMPORARY_START_COUNT","ONE_WIRE_DISABLE_BY_CHG","ONE_WIRE_SET_ENABLE",
            "Breathing_Light_FINISH","Breathing_Light_START","BUTTON_COMPLETE_MULTI_CLICK","ENABLE_MULTI_CLICK_COUNTER","BUTTON_CLICK_For_COC_LOCK","BUTTON_CLICK","BUTTON_LONG_PRESS","BUTTON_PRESS"
        };
        private Label[] G_Add_Module_Function_StatusLabel;
       //============================================


        //============================================
        //set Bit Label string ; 14 length
        // 15~8 bits
        // 7~0 bits
        string[] G_Device_Interface_Status1Text =
        {
            "HW_DSG_Status","HW_CHG_Status","BackLight Blinking","BackLight Constant On","BackLight OnOff","BackLight Sw Click","BackLight Sw Press","SYS_INFO_RECORD_TO_EEPROM",
            "POLLING_TIMER_ENABLE_STATUS","NTC_ENABLE_STATUS","UART_ISOLATE_ENABLE_STATUS","ONE_WIRE_ENABLE_STATUS","ADP_SOC_STATUS","ADC_Conversion","Dsg Mos TurnON","Chg Mos TurnON"
        };
        private Label[] G_Device_Interface_Status1Label;
        //============================================
        
        //============================================
        //set Bit Label string ; 14 length
        // 15~8 bits
        // 7~0 bits
        string[] G_Add_Device_Interface_StatusText =
        {
            "-","-","-","SET_DSG_MOS_OFF","SET_CHG_MOS_OFF","HasSleptOnce","set_CHGmos_Off","set_DSGmos_Off",
            "UART_RX_FRAME_PACKET_FAIL","UART_RX_FRAME_ADDRESS_FAIL","UART_RX_EndingCode_Find","UART_RX_PrecedingCode_Find","UART_RX_FRAME_DONE","UART_RX_IT_STATUS","UART_TX_IT_STATUS","UART_STATUS"
        };
        private Label[] G_Add_Device_Interface_StatusLabel;
        //============================================
        //============================================
        //set Bit Label string ; 14 length
        // 15~8 bits
        // 7~0 bits
        string[] G_Capacity_Var_Bits_StatusText =
        {
            "Cap_Defference_Delay_Finish_Flag","Cap_Defference_Delay_Count_Flag","Cap_Hold_CHG_To_Static","Cap_Hold_DSG_To_Static","User_Set_DSG_Capacity_Displaying_FINISH","User_Set_DSG_Capacity_Displaying","Capacity_Hold_In_CHG","Capacity_Showing_Hold",
            "CAP_UPDATED_ONEC","FCC_1_SEC_FLAG","CHG_FCC_SET","START_COUNT_FCC","CAP_FUN_Interrupt_Exec_ON","Polling_Set_CHG_Capacity_Displaying","CAP_1_SEC_FLAG","Timer_Polling_XOR_Flag"
        };
        private Label[] G_Capacity_Var_Bits_StatusLabel;
        //============================================
        //============================================
        string[] G_CongifSegmentText =
        {

"CHG_mA_To_ADC_Factor                                       ",
"DSG_mA_To_ADC_Factor                                       ",
"VBAT_mV_To_ADC_Factor                                      ",
"Thermistor_mV_To_ADC_Factor                                ",
"DSG_OP_ADC_OFFSET                                          ",
"CHG_OP_ADC_OFFSET                                          ",
"VBAT_ADC_OFFSET                                            ",
"NTC1_ADC_OFFSET                                            ",
"NTC2_ADC_OFFSET                                            ",
"SOC_ADC_OFFSET                                             ",
"R_Sense_10u_ohm                                            ",
"MCU_Major_Type_Code                                        ",
"MCU_Minor_Type_Code                                        ",
"RESERVED_CAL_FOR_OFFSET2                                   ",
"RESERVED_CAL_FOR_OFFSET3                                   ",
"MAX_DSG_C_ADC_RECORD_EEPROM                                ",
"MAX_CHG_C_ADC_RECORD_EEPROM                                ",
"MAX_VBAT_ADC_RECORD_EEPROM                                 ",
"MIN_VBAT_ADC_RECORD_EEPROM                                 ",
"MAX_VBAT_SocLo_ADC_RECORD_EEPROM                           ",
"MAX_VBAT_SocHi_ADC_RECORD_EEPROM                           ",
"DSG_MAX_TH1_ADC_RECORD_EEPROM                              ",
"DSG_MIN_TH1_ADC_RECORD_EEPROM                              ",
"DSG_MAX_TH2_ADC_RECORD_EEPROM                              ",
"DSG_MIN_TH2_ADC_RECORD_EEPROM                              ",
"RECORD_DATA_COUNT_EEPROM                                   ",
"CHG_Cycle_Count_RECORD_EEPROM                              ",
"CHG_ADC_AccumulatingQ_RECORD_EEPROM                        ",
"DSG_ADC_AccumulatingQ_RECORD_EEPROM                        ",
"DSG_Cycle_Count_RECORD_EEPROM                              ",
"RESERVED_Recording_FOR_OFFSET1                             ",
"CHG_MAX_TH1_ADC_RECORD_EEPROM                              ",
"CHG_MIN_TH1_ADC_RECORD_EEPROM                              ",
"CHG_MAX_TH2_ADC_RECORD_EEPROM                              ",
"CHG_MIN_TH2_ADC_RECORD_EEPROM                              ",
"G_OVP_TIMES_RECORD_EEPROM                                  ",
"G_UVP_TIMES_RECORD_EEPROM                                  ",
"G_COCP_TIMES_RECORD_EEPROM                                 ",
"G_DOCP_TIMES_RECORD_EEPROM                                 ",
"G_TH1_CHG_UTP_TIMES_RECORD_EEPROM                          ",
"G_TH2_CHG_UTP_TIMES_RECORD_EEPROM                          ",
"G_CHG_TH1_OTP_TIMES_RECORD_EEPROM                          ",
"G_CHG_TH2_OTP_TIMES_RECORD_EEPROM                          ",
"RECORD_2nd_DATA_COUNT_EEPROM                               ",
"RESERVED_Recording_FOR_OFFSET3                             ",
"SystemSetting_Info_Byte1                                   ",
"SystemSetting_Info_Byte2                                   ",
"System_Control_Bit_EEPROM                                  ",
"SystemSetting_Info_Byte3                                   ",
"VERSION                                                    ",
"MINOR_VERSION                                              ",
"EEPROM_VERSION                                             ",
"RESERVED_VERSION                                           ",
"NUMBER_OF_PARALLEL_CELLS                                   ",
"NUMBER_OF_SERIES_CELLS                                     ",
"MANUFACTURE_DATE                                           ",
"SERIAL_NUMBER                                              ",
"CELL_TYPE_LENGTH                                           ",
"CELL_TYPE                                                  ",
"MANUFACTURE_NAME_LENGTH                                    ",
"MANUFACTURE_NAME                                           ",
"ADC_CURRENT_DETECT_FOR_DSG_STATUS                          ",
"ADC_CURRENT_DETECT_FOR_CHG_STATUS                          ",
"ADC_DOC_PROTECTION                                         ",
"ADC_COC_PROTECTION                                         ",
"ADC_DSG_HIGH_CURRENT_DETECT                                ",
"ADC_CHG_CHARGER_TAPE_CURRENT                               ",
"ADC_AccQ_FOR_CHG_TH                                        ",
"Cycle_Count_FOR_CHG_1st_TH                                 ",
"Cycle_Count_FOR_CHG_2nd_TH                                 ",
"ADC_BATTERY_OV_PROTECTION                                  ",
"ADC_BATTERY_OV_RELEASE                                     ",
"ADC_BATTERY_UV_PROTECTION                                  ",
"ADC_BATTERY_UV_RELEASE                                     ",
"ADC_DSG_OT_HIGH_PROTECTION                                 ",
"ADC_DSG_OT_HIGH_RELEASE                                    ",
"ADC_DSG_OT_LOW_PROTECTION                                  ",
"ADC_DSG_OT_LOW_RELEASE                                     ",
"ADC_CHG_OT_PROTECTION                                      ",
"ADC_CHG_OT_RELEASE                                         ",
"ADC_UT_PROTECTION                                          ",
"ADC_UT_RELEASE                                             ",
"ADC_INITIAL_CHARGING_TEMP_RANGE_HI                         ",
"ADC_INITIAL_CHARGING_TEMP_RANGE_LO                         ",
"ADC_LOW_TEMP_SOC_CHARGING_RANGE_HI                         ",
"ADC_LOW_TEMP_SOC_CHARGING_RANGE_LO                         ",
"ADC_AccQ_FOR_DSG_TH                                        ",
"DSG_CAPACITY_DISPLAY_TH_1                                  ",
"DSG_CAPACITY_DISPLAY_TH_2                                  ",
"DSG_CAPACITY_DISPLAY_TH_3                                  ",
"DSG_CAPACITY_DISPLAY_TH_4                                  ",
"DSG_CAPACITY_DISPLAY_TH_5                                  ",
"CHG_CAPACITY_DISPLAY_TH_1                                  ",
"CHG_CAPACITY_DISPLAY_TH_2                                  ",
"CHG_CAPACITY_DISPLAY_TH_3                                  ",
"CHG_CAPACITY_DISPLAY_TH_4                                  ",
"_ADC_LOOKUP_DSG_TEMP_1_TH_                                 ",
"_ADC_LOOKUP_DSG_TEMP_2_TH_                                 ",
"_ADC_LOOKUP_DSG_TEMP_3_TH_                                 ",
"_ADC_LOOKUP_CHG_TEMP_1_TH_                                 ",
"_ADC_LOOKUP_CHG_TEMP_2_TH_                                 ",
"_ADC_DSG_CURRENT_LOOKUP_OCV_TABLE_TH1_                     ",
"_ADC_DSG_CURRENT_LOOKUP_OCV_TABLE_TH2_                     ",
"_ADC_DSG_CURRENT_LOOKUP_OCV_TABLE_TH3_                     ",
"_ADC_DSG_CURRENT_LOOKUP_OCV_TABLE_TH4_                     ",
"_ADC_DSG_CURRENT_LOOKUP_OCV_TABLE_TH5_                     ",
"_ADC_DSG_CURRENT_LOOKUP_OCV_TABLE_TH6_                     ",
"AUTO_ENTRY_SLEEPING_DELAY_MINUTES                          ",
"CAPACITY_DIFFERENCE_VALUES                                 ",
"PROJECT_NAME_MAX_LENGTH                                    ",
"PROJECT_NAME                                               ",
"MCU_UID_MAX_LENGTH                                         ",
"MCU_UID                                                    ",
"BAR_CODE_REAL_STORE_LENGTH                                 ",
"BAR_CODE_MAX_LENGTH                                        ",
"BAR_CODE                                                   ",
"DESIGN_CAPACITY_mAH                                        ",
"Last_Record_FCC_mAh_RECORD_EEPROM                          ",
"REAL_FCC_UPDATE_TIMES_RECORD_EEPROM                        ",
"REAL_FCC_mAH_RECORD_EEPROM                                 ",
"STATIC_OVER_VOLTAGE_HOURS_TIMES_RECORD_EEPROM              ",
"CHG_OVER_VOLTAGE_MINUTES_TIMES_RECORD_EEPROM               ",
"OVER_LOADING_MINUTES_TIMES_RECORD_EEPROM                   ",
"FASTER_CHARGING_MINUTES_TIMES_RECORD_EEPROM                ",
"CHARGING_IN_HIGH_TEMP_MINUTES_TIMES_RECORD_EEPROM          ",
"CHARGING_IN_LOW_TEMP_MINUTES_TIMES_RECORD_EEPROM           ",
"STORE_IN_LOW_TEMP1_HOURS_TIMES_RECORD_EEPROM               ",
"STORE_IN_LOW_TEMP2_HOURS_TIMES_RECORD_EEPROM               ",
"STORE_IN_LOW_TEMP3_HOURS_TIMES_RECORD_EEPROM               ",
"STORE_IN_LOW_TEMP4_HOURS_TIMES_RECORD_EEPROM               ",
"G_DSG_TH1_LOW_CURRENT_OTP_TIMES_RECORD_EEPROM              ",
"G_DSG_TH1_HIGH_CURRENT_OTP_TIMES_RECORD_EEPROM             ",
"G_DSG_TH2_LOW_CURRENT_OTP_TIMES_RECORD_EEPROM              ",
"G_DSG_TH2_HIGH_CURRENT_OTP_TIMES_RECORD_EEPROM             ",
"STORE_IN_HIGH_TEMP1_MINUTES_TIMES_RECORD_EEPROM            ",
"STORE_IN_HIGH_TEMP2_MINUTES_TIMES_RECORD_EEPROM            ",
"STORE_IN_HIGH_TEMP3_MINUTES_TIMES_RECORD_EEPROM            ",
"STORE_IN_HIGH_TEMP4_MINUTES_TIMES_RECORD_EEPROM            ",
"STORE_IN_HIGH_TEMP5_MINUTES_TIMES_RECORD_EEPROM            ",
"RECORD_3rd_TRACKING_DATA_COUNT_EEPROM                      ",
"LOW_TEMP1_IN_DSG_ACT_RECORD_MINUTES_EEPROM                 ",
"LOW_TEMP2_IN_DSG_ACT_RECORD_MINUTES_EEPROM                 ",
"LOW_TEMP3_IN_DSG_ACT_RECORD_MINUTES_EEPROM                 ",
"RECORDING_System_Activated_Times_For_TotalHours            ",
"RECORDING_Reserved_Data                                    ",
"RECORDING_Reserved_Data1                                   ",
"RECORDING_Reserved_Data2                                   ",
"RECORDING_System_Activated_Times_Minutes_For_1_Hours       ",
"ShakeSwitchDetect_RangeTime_By_AutoWakeUp_TimeCycles       ",
"ShakeSwitchTriggerTimes_For_WakeUp                         ",
"GSM_SetInterLockTimes_BeforeBMSSendData                    ",
"GSM_SetDelayTimes_ForBMSCheckMosStatus                     ",
"GSM_System_Enter_SleepingMode_DelayTime_For_STATIC         ",
"GSM_SendDataFor_EachDelayTimes_For_DSG                     ",
"GSM_SendDataFor_EachDelayTimes_For_CHG                     ",
"GSM_SendData_For_StaticSleeping_By_AutoWakeUp_TimeCycles   ",
"GSM_System_WakeUp_ReadyTimes_In_SleepingMode               ",
"SleepMode_Autowakeup_Intervaltimes_ms                      ",
"SleepMode_Autowakeup_Intervaltimes_sec                     ",
"SleepMode_Autowakeup_Intervaltimes_min                     ",
"LastTotalTimes_Without_Charging_Minutes_RECORD_EEPROM      ",
"MaxTotalTimes_Without_Charging_Minutes_RECORD_EEPROM       ",
"LastTotalTimes_Without_DisCharging_Minutes_RECORD_EEPROM   ",
"MaxTotalTimes_Without_DisCharging_Minutes_RECORD_EEPROM    ",
"Last_ChargingTimes_Minutes_RECORD_EEPROM                   ",
"Max_ChargingTimes_Minutes_RECORD_EEPROM                    ",
"RECORDING_ADC_DSG_OVER_CURRENT_1_6SEC_EEPROM               ",
"RECORDING_ADC_DSG_OVER_CURRENT_2_6SEC_EEPROM               ",
"RECORDING_ADC_DSG_OVER_CURRENT_3_6SEC_EEPROM               ",
"RECORDING_ADC_DSG_OVER_CURRENT_4_6SEC_EEPROM               ",
"RECORDING_ADC_DSG_OVER_CURRENT_5_6SEC_EEPROM               ",
"RECORDING_ADC_DSG_OVER_CURRENT_6_6SEC_EEPROM               ",
                       


"EEPROM_END_DATA_POSITION                                "
   
        

        };
        string[] G_CongifSegmentDataType = 
        {
//" _ee_address_CONFIG_SEGMENT                                    ",


"_ee_float_CHG_mA_To_ADC_Factor                                           ",
"_ee_float_DSG_mA_To_ADC_Factor                                           ",
"_ee_float_VBAT_mV_To_ADC_Factor                                          ",
"_ee_float_Thermistor_mV_To_ADC_Factor                                    ",
"_ee_char_DSG_OP_ADC_OFFSET                                               ",
"_ee_char_CHG_OP_ADC_OFFSET                                               ",
"_ee_char_VBAT_ADC_OFFSET                                                 ",
"_ee_char_NTC1_ADC_OFFSET                                                 ",
"_ee_char_NTC2_ADC_OFFSET                                                 ",
"_ee_char_SOC_ADC_OFFSET                                                  ",
"_ee_uint_R_Sense_10u_ohm                                                 ",
"_ee_uchar_MCU_Major_Type_Code                                            ",
"_ee_uchar_MCU_Minor_Type_Code                                            ",
"_ee_ulong_RESERVED_CAL_FOR_OFFSET2                                       ",
"_ee_uint_RESERVED_CAL_FOR_OFFSET3                                        ",
"_ee_uint_MAX_DSG_C_ADC_RECORD_EEPROM                                     ",
"_ee_uint_MAX_CHG_C_ADC_RECORD_EEPROM                                     ",
"_ee_uint_MAX_VBAT_ADC_RECORD_EEPROM                                      ",
"_ee_uint_MIN_VBAT_ADC_RECORD_EEPROM                                      ",
"_ee_uint_MAX_VBAT_SocLo_ADC_RECORD_EEPROM                                ",
"_ee_uint_MAX_VBAT_SocHi_ADC_RECORD_EEPROM                                ",
"_ee_uint_DSG_MAX_TH1_ADC_RECORD_EEPROM                                   ",
"_ee_uint_DSG_MIN_TH1_ADC_RECORD_EEPROM                                   ",
"_ee_uint_DSG_MAX_TH2_ADC_RECORD_EEPROM                                   ",
"_ee_uint_DSG_MIN_TH2_ADC_RECORD_EEPROM                                   ",
"_ee_uint_RECORD_DATA_COUNT_EEPROM                                        ",
"_ee_uint_CHG_Cycle_Count_RECORD_EEPROM                                   ",
"_ee_ulong_CHG_ADC_AccumulatingQ_RECORD_EEPROM                            ",
"_ee_ulong_DSG_ADC_AccumulatingQ_RECORD_EEPROM                            ",
"_ee_uint_DSG_Cycle_Count_RECORD_EEPROM                                   ",
"_ee_uint_RESERVED_Recording_FOR_OFFSET1                                  ",
"_ee_uint_CHG_MAX_TH1_ADC_RECORD_EEPROM                                   ",
"_ee_uint_CHG_MIN_TH1_ADC_RECORD_EEPROM                                   ",
"_ee_uint_CHG_MAX_TH2_ADC_RECORD_EEPROM                                   ",
"_ee_uint_CHG_MIN_TH2_ADC_RECORD_EEPROM                                   ",
"_ee_uint_G_OVP_TIMES_RECORD_EEPROM                                       ",
"_ee_uint_G_UVP_TIMES_RECORD_EEPROM                                       ",
"_ee_uint_G_COCP_TIMES_RECORD_EEPROM                                      ",
"_ee_uint_G_DOCP_TIMES_RECORD_EEPROM                                      ",
"_ee_uint_G_TH1_CHG_UTP_TIMES_RECORD_EEPROM                               ",
"_ee_uint_G_TH2_CHG_UTP_TIMES_RECORD_EEPROM                               ",
"_ee_uint_G_CHG_TH1_OTP_TIMES_RECORD_EEPROM                               ",
"_ee_uint_G_CHG_TH2_OTP_TIMES_RECORD_EEPROM                               ",
"_ee_uint_RECORD_2nd_DATA_COUNT_EEPROM                                    ",
"_ee_uint_RESERVED_Recording_FOR_OFFSET3                                  ",
"_ee_uchar_SystemSetting_Info_Byte1                                       ",
"_ee_uchar_SystemSetting_Info_Byte2                                       ",
"_ee_uchar_System_Control_Bit_EEPROM                                      ",
"_ee_uchar_SystemSetting_Info_Byte3                                       ",
"_ee_uchar_VERSION                                                        ",
"_ee_uchar_MINOR_VERSION                                                  ",
"_ee_uchar_EEPROM_VERSION                                                 ",
"_ee_uchar_RESERVED_VERSION                                               ",
"_ee_uchar_NUMBER_OF_PARALLEL_CELLS                                       ",
"_ee_uchar_NUMBER_OF_SERIES_CELLS                                         ",
"_ee_uint_MANUFACTURE_DATE                                                ",
"_ee_uint_SERIAL_NUMBER                                                   ",
"_ee_str_len_CELL_TYPE_LENGTH                                             ",
"_ee_str_CELL_TYPE                                                        ",
"_ee_str_len_MANUFACTURE_NAME_LENGTH                                      ",
"_ee_str_MANUFACTURE_NAME                                                 ",
"_ee_uint_ADC_CURRENT_DETECT_FOR_DSG_STATUS                               ",
"_ee_uint_ADC_CURRENT_DETECT_FOR_CHG_STATUS                               ",
"_ee_uint_ADC_DOC_PROTECTION                                              ",
"_ee_uint_ADC_COC_PROTECTION                                              ",
"_ee_uint_ADC_DSG_HIGH_CURRENT_DETECT                                     ",
"_ee_uint_ADC_CHG_CHARGER_TAPE_CURRENT                                    ",
"_ee_ulong_ADC_AccQ_FOR_CHG_TH                                            ",
"_ee_uint_Cycle_Count_FOR_CHG_1st_TH                                      ",
"_ee_uint_Cycle_Count_FOR_CHG_2nd_TH                                      ",
"_ee_uint_ADC_BATTERY_OV_PROTECTION                                       ",
"_ee_uint_ADC_BATTERY_OV_RELEASE                                          ",
"_ee_uint_ADC_BATTERY_UV_PROTECTION                                       ",
"_ee_uint_ADC_BATTERY_UV_RELEASE                                          ",
"_ee_uint_ADC_DSG_OT_HIGH_PROTECTION                                      ",
"_ee_uint_ADC_DSG_OT_HIGH_RELEASE                                         ",
"_ee_uint_ADC_DSG_OT_LOW_PROTECTION                                       ",
"_ee_uint_ADC_DSG_OT_LOW_RELEASE                                          ",
"_ee_uint_ADC_CHG_OT_PROTECTION                                           ",
"_ee_uint_ADC_CHG_OT_RELEASE                                              ",
"_ee_uint_ADC_UT_PROTECTION                                               ",
"_ee_uint_ADC_UT_RELEASE                                                  ",
"_ee_uint_ADC_INITIAL_CHARGING_TEMP_RANGE_HI                              ",
"_ee_uint_ADC_INITIAL_CHARGING_TEMP_RANGE_LO                              ",
"_ee_uint_ADC_LOW_TEMP_SOC_CHARGING_RANGE_HI                              ",
"_ee_uint_ADC_LOW_TEMP_SOC_CHARGING_RANGE_LO                              ",
"_ee_ulong_ADC_AccQ_FOR_DSG_TH                                            ",
"_ee_uint_DSG_CAPACITY_DISPLAY_TH_1                                       ",
"_ee_uint_DSG_CAPACITY_DISPLAY_TH_2                                       ",
"_ee_uint_DSG_CAPACITY_DISPLAY_TH_3                                       ",
"_ee_uint_DSG_CAPACITY_DISPLAY_TH_4                                       ",
"_ee_uint_DSG_CAPACITY_DISPLAY_TH_5                                       ",
"_ee_uint_CHG_CAPACITY_DISPLAY_TH_1                                       ",
"_ee_uint_CHG_CAPACITY_DISPLAY_TH_2                                       ",
"_ee_uint_CHG_CAPACITY_DISPLAY_TH_3                                       ",
"_ee_uint_CHG_CAPACITY_DISPLAY_TH_4                                       ",
"_ee_uint__ADC_LOOKUP_DSG_TEMP_1_TH_                                      ",
"_ee_uint__ADC_LOOKUP_DSG_TEMP_2_TH_                                      ",
"_ee_uint__ADC_LOOKUP_DSG_TEMP_3_TH_                                      ",
"_ee_uint__ADC_LOOKUP_CHG_TEMP_1_TH_                                      ",
"_ee_uint__ADC_LOOKUP_CHG_TEMP_2_TH_                                      ",
"_ee_uint__ADC_DSG_CURRENT_LOOKUP_OCV_TABLE_TH1_                          ",
"_ee_uint__ADC_DSG_CURRENT_LOOKUP_OCV_TABLE_TH2_                          ",
"_ee_uint__ADC_DSG_CURRENT_LOOKUP_OCV_TABLE_TH3_                          ",
"_ee_uint__ADC_DSG_CURRENT_LOOKUP_OCV_TABLE_TH4_                          ",
"_ee_uint__ADC_DSG_CURRENT_LOOKUP_OCV_TABLE_TH5_                          ",
"_ee_uint__ADC_DSG_CURRENT_LOOKUP_OCV_TABLE_TH6_                          ",
"_ee_uint_AUTO_ENTRY_SLEEPING_DELAY_MINUTES                               ",
"_ee_uint_CAPACITY_DIFFERENCE_VALUES                                      ",
"_ee_str_len_PROJECT_NAME_MAX_LENGTH                                      ",
"_ee_str_PROJECT_NAME                                                     ",
"_ee_str_len_MCU_UID_MAX_LENGTH                                           ",
"_ee_str_MCU_UID                                                          ",
"_ee_uchar_BAR_CODE_REAL_STORE_LENGTH                                     ",
"_ee_str_len_BAR_CODE_MAX_LENGTH                                          ",
"_ee_str_BAR_CODE                                                         ",
"_ee_uint_DESIGN_CAPACITY_mAH                                             ",
"_ee_uint_Last_Record_FCC_mAh_RECORD_EEPROM                               ",
"_ee_uint_REAL_FCC_UPDATE_TIMES_RECORD_EEPROM                             ",
"_ee_uint_REAL_FCC_mAH_RECORD_EEPROM                                      ",
"_ee_uint_STATIC_OVER_VOLTAGE_HOURS_TIMES_RECORD_EEPROM                   ",
"_ee_uint_CHG_OVER_VOLTAGE_MINUTES_TIMES_RECORD_EEPROM                    ",
"_ee_uint_OVER_LOADING_MINUTES_TIMES_RECORD_EEPROM                        ",
"_ee_uint_FASTER_CHARGING_MINUTES_TIMES_RECORD_EEPROM                     ",
"_ee_uint_CHARGING_IN_HIGH_TEMP_MINUTES_TIMES_RECORD_EEPROM               ",
"_ee_uint_CHARGING_IN_LOW_TEMP_MINUTES_TIMES_RECORD_EEPROM                ",
"_ee_uint_STORE_IN_LOW_TEMP1_HOURS_TIMES_RECORD_EEPROM                    ",
"_ee_uint_STORE_IN_LOW_TEMP2_HOURS_TIMES_RECORD_EEPROM                    ",
"_ee_uint_STORE_IN_LOW_TEMP3_HOURS_TIMES_RECORD_EEPROM                    ",
"_ee_uint_STORE_IN_LOW_TEMP4_HOURS_TIMES_RECORD_EEPROM                    ",
"_ee_uint_G_DSG_TH1_LOW_CURRENT_OTP_TIMES_RECORD_EEPROM                   ",
"_ee_uint_G_DSG_TH1_HIGH_CURRENT_OTP_TIMES_RECORD_EEPROM                  ",
"_ee_uint_G_DSG_TH2_LOW_CURRENT_OTP_TIMES_RECORD_EEPROM                   ",
"_ee_uint_G_DSG_TH2_HIGH_CURRENT_OTP_TIMES_RECORD_EEPROM                  ",
"_ee_uint_STORE_IN_HIGH_TEMP1_MINUTES_TIMES_RECORD_EEPROM                 ",
"_ee_uint_STORE_IN_HIGH_TEMP2_MINUTES_TIMES_RECORD_EEPROM                 ",
"_ee_uint_STORE_IN_HIGH_TEMP3_MINUTES_TIMES_RECORD_EEPROM                 ",
"_ee_uint_STORE_IN_HIGH_TEMP4_MINUTES_TIMES_RECORD_EEPROM                 ",
"_ee_uint_STORE_IN_HIGH_TEMP5_MINUTES_TIMES_RECORD_EEPROM                 ",
"_ee_uint_RECORD_3rd_TRACKING_DATA_COUNT_EEPROM                           ",
"_ee_uint_LOW_TEMP1_IN_DSG_ACT_RECORD_MINUTES_EEPROM                      ",
"_ee_uint_LOW_TEMP2_IN_DSG_ACT_RECORD_MINUTES_EEPROM                      ",
"_ee_uint_LOW_TEMP3_IN_DSG_ACT_RECORD_MINUTES_EEPROM                      ",
"_ee_int_RECORDING_System_Activated_Times_For_TotalHours                  ",
"_ee_uchar_RECORDING_Reserved_Data                                        ",
"_ee_uchar_RECORDING_Reserved_Data1                                       ",
"_ee_uchar_RECORDING_Reserved_Data2                                       ",
"_ee_uchar_RECORDING_System_Activated_Times_Minutes_For_1_Hours           ",
"_ee_uchar_ShakeSwitchDetect_RangeTime_By_AutoWakeUp_TimeCycles           ",
"_ee_uchar_ShakeSwitchTriggerTimes_For_WakeUp                             ",
"_ee_uchar_GSM_SetInterLockTimes_BeforeBMSSendData                        ",
"_ee_uchar_GSM_SetDelayTimes_ForBMSCheckMosStatus                         ",
"_ee_uint_GSM_System_Enter_SleepingMode_DelayTime_For_STATIC              ",
"_ee_uint_GSM_SendDataFor_EachDelayTimes_For_DSG                          ",
"_ee_uint_GSM_SendDataFor_EachDelayTimes_For_CHG                          ",
"_ee_uint_GSM_SendData_For_StaticSleeping_By_AutoWakeUp_TimeCycles        ",
"_ee_uint_GSM_System_WakeUp_ReadyTimes_In_SleepingMode                    ",
"_ee_uint_SleepMode_Autowakeup_Intervaltimes_ms                           ",
"_ee_float_SleepMode_Autowakeup_Intervaltimes_sec                         ",
"_ee_float_SleepMode_Autowakeup_Intervaltimes_min                         ",
"_ee_ulong_LastTotalTimes_Without_Charging_Minutes_RECORD_EEPROM          ",
"_ee_ulong_MaxTotalTimes_Without_Charging_Minutes_RECORD_EEPROM           ",
"_ee_ulong_LastTotalTimes_Without_DisCharging_Minutes_RECORD_EEPROM       ",
"_ee_ulong_MaxTotalTimes_Without_DisCharging_Minutes_RECORD_EEPROM        ",
"_ee_uint_Last_ChargingTimes_Minutes_RECORD_EEPROM                        ",
"_ee_uint_Max_ChargingTimes_Minutes_RECORD_EEPROM                         ",
"_ee_ulong_RECORDING_ADC_DSG_OVER_CURRENT_1_6SEC_EEPROM                   ",
"_ee_ulong_RECORDING_ADC_DSG_OVER_CURRENT_2_6SEC_EEPROM                   ",
"_ee_ulong_RECORDING_ADC_DSG_OVER_CURRENT_3_6SEC_EEPROM                   ",
"_ee_ulong_RECORDING_ADC_DSG_OVER_CURRENT_4_6SEC_EEPROM                   ",
"_ee_ulong_RECORDING_ADC_DSG_OVER_CURRENT_5_6SEC_EEPROM                   ",
"_ee_ulong_RECORDING_ADC_DSG_OVER_CURRENT_6_6SEC_EEPROM                   ",

               
"_ee_uchar_EEPROM_END_DATA_POSITION                               ",               
"_ee_uchar_EEPROM_PN_INFO_START_DATA_POSITION                     ",               
"_ee_str_len_PN_DAK_NAME_MAX_LENGTH                               ",               
"_ee_str_PN_DAK_NAME                                              ",               
"_ee_str_len_PN_85K_NAME_MAX_LENGTH                               ",               
"_ee_str_PN_85K_NAME                                              ",               
"_ee_str_len_Cell_PN_NAME_MAX_LENGTH                              ",               
"_ee_str_Cell_PN_NAME                                             ",               
"_ee_uchar_EEPROM_PN_INFO_END_DATA_POSITION                       "        


        };
        private Label[] G_CongifSegmentTextLabel;
        private Label[] G_CongifSegmentValuesLabel;
        //=======================================================
        //=======================================================
       private void InitializeAdditionalFormComponent()
        {
            byte[] buf = new byte[116];
            for (int i = 0; i < 116; i++)
            {
                buf[i] = (byte)(0x80 + Convert.ToSByte(i));
            }
           /*
            Set2BytesIndicationData(buf, ref IndicationModuleStatusLabel);
            Set2BytesIndicationData(buf, ref G_Activate_Action_StatusLabel);
            Set2BytesIndicationData(buf, ref G_Activate_Action_Status_other1_Label);
            SetTwoColumnIndicationValues(buf, ref G_CongifSegmentValuesLabel, G_CongifSegmentDataType);*/



            //set GlobalValues Label string and text box; TwoColumnTextBox
            GlobalValuesText = new TextBox[GlobalValuesLabelString.Length];
            GlobalValuesLabel = new Label[GlobalValuesLabelString.Length];
            setGUIGroupBoxContainForTwoColumnTextBox(ref GlobalValuesLabelString, ref GlobalValuesLabel, ref GlobalValuesText, ref GlobalValuesgroupBox);
            //SetTwoColumnTextBoxValues(buf, ref ADCDataText);


            //set Sys Mode Status Codes
            SysModeStatusLabel = new Label();
            setGUIGroupBoxContainForCurrentStatus(ref SysModeStatusText, ref SysModeStatusLabel, ref SystemMode_groupBox);
            //SetCurrentStatusData(5, ref SysModeStatusText, ref SysModeStatusLabel);

            //set Sys Module Status
            G_SysModuleStatusLabel = new Label[G_SysModuleStatusText.Length];
            setGUIGroupBoxContainFor4Line2BytesIndication(ref G_SysModuleStatusText, ref G_SysModuleStatusLabel, ref SystemModuleStatus_groupBox);
            //Set2BytesIndicationData(buf, ref G_SysModuleStatusLabel);

            //set Auxiliary Module Status
            G_Module_Function_StatusLabel = new Label[G_Module_Function_StatusText.Length];
            setGUIGroupBoxContainFor4Line2BytesIndication(ref G_Module_Function_StatusText, ref G_Module_Function_StatusLabel, ref SystemAuxiliaryModuleStatus_groupBox);
            //Set2BytesIndicationData(buf, ref G_Auxiliary_Module_StatusLabel);


            //set Add_Module_Function_Status
            G_Add_Module_Function_StatusLabel = new Label[G_Add_Module_Function_StatusText.Length];
            setGUIGroupBoxContainFor4Line2BytesIndication(ref G_Add_Module_Function_StatusText, ref G_Add_Module_Function_StatusLabel, ref SystemAddModuleFunctionStatus_groupBox);
            //Set2BytesIndicationData(buf, ref G_LED_Interface_Status1Label);
            
            //set  Device_Interface_Status1
            G_Device_Interface_Status1Label = new Label[G_Device_Interface_Status1Text.Length];
            setGUIGroupBoxContainFor4Line2BytesIndication(ref G_Device_Interface_Status1Text, ref G_Device_Interface_Status1Label, ref DeviceInterfaceStatus_groupBox);
            //Set2BytesIndicationData(buf, ref G_Device_Interface_Status1Label);

            //set  G_Add_Device_Interface_Status
            G_Add_Device_Interface_StatusLabel = new Label[G_Add_Device_Interface_StatusText.Length];
            setGUIGroupBoxContainFor4Line2BytesIndication(ref G_Add_Device_Interface_StatusText, ref G_Add_Device_Interface_StatusLabel, ref AddDeviceInterfaceStatus_groupBox);
            //Set2BytesIndicationData(buf, ref G_Add_Device_Interface_StatusLabel);

            //set  G_Capacity_Var_Bits_Status
            G_Capacity_Var_Bits_StatusLabel = new Label[G_Capacity_Var_Bits_StatusText.Length];
            setGUIGroupBoxContainFor4Line2BytesIndication(ref G_Capacity_Var_Bits_StatusText, ref G_Capacity_Var_Bits_StatusLabel, ref Capacity_Status_groupBox);
            //Set2BytesIndicationData(buf, ref G_Capacity_Var_Bits_StatusLabel);

            //set ADCRecord Label string and text box; TwoColumnTextBox
            //ADCRecordDataText = new TextBox[ADCRecordLabelString.Length];
            //ADCRecordLabel = new Label[ADCRecordLabelString.Length];
            //setGUIGroupBoxContainForTwoColumnTextBox(ref ADCRecordLabelString, ref ADCRecordLabel, ref ADCRecordDataText, ref Recording_groupBox);
            //SetTwoColumnTextBoxValues(buf, ref ADCDataText);


            G_CongifSegmentTextLabel = new Label[G_CongifSegmentText.Length];
            G_CongifSegmentValuesLabel = new Label[G_CongifSegmentText.Length];
            setGUIGroupBoxContainFor_Flash_2_ColumnLabels(ref G_CongifSegmentText, ref G_CongifSegmentTextLabel, ref G_CongifSegmentValuesLabel, ref ConfigSegmentGroupBox);


       }



    }
}
